{% extends "menu.html" %}
{% block content %}

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">



            </div>
            <div class="clearfix"></div>

                  <div class="x_panel">
                  <div class="x_title">
                    <h1>{{ article_info.title }}</h1>

                    <div class="clearfix"></div>

                  </div>
                  <div class="x_content">
                  <div class="sui-btn-group">
                      <ul>
                          <li><a class="sui-btn btn-bordered btn-primary" href="/article/update/?id={{ article_info.id }}">编辑</a></li>
                          <li style="margin-top: 5px;"><a class="sui-btn btn-bordered btn-primary" href="/article/delete/?id={{ article_info.id }}">删除</a></li>
                      </ul>

                  </div>
                  <div class="clearfix"></div>
                    <br />
                      <div id="content_left" style="float:left; width: 90%">

                            {{ article_info.content|safe }}
                        </div>
                      <div id="content_right" style="float:left; width: 10%;">

                        </div>

                </div>
              </div>
            </div>


          </div>
        </div>
    <script>

    $("#content_left h1").each(function (index) {
        var h1_name="title"+index
        var btn_num = "btn"+index
        $(this).attr("id",h1_name)
        {#修改h1 标签name属性#}
        var title=$(this).text()
        var tile_name=$(this).name
        {#获取h1标签的标题#}
        {#var t_title="<div class='sui-msg msg-info' style='width: 100%;'><div class='msg-con'>" +"<a href='/article/list/?id="+{{ article_info.id }} +"#" +num +">" +title + "</a>"+"</div><s class='msg-icon'></s></div><br><br>"#}
        var t_title= "<div class='sui-msg msg-info'>" + "<div class='test msg-con' id=" +btn_num + ">" +title +"</div>" + "<s class='msg-icon'><s>" + "</div><br><br>"

        {#得到子文档h1目录结构#}
        $("#content_right").append(t_title)

    })

    $(function () {
        $('.test').click(function () {
            var id = $(this).attr('id').substr(-1, 1);
            $('#title' + id).attr('tabIndex', -1).focus();
            console.log($('#title' + id))

        })
    })
    </script>



{% endblock %}